#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int q = 0;
    cin >> q;
    int a, b, c;
    while (q--)
    {
        cin >> a >> b >> c;
        int m = min(min(a, b), c);
        int n = b - m - 1;
        int r = max(n, 0);
        cout << (2 * m + r) << endl;
    }
    return 0;
}